<?php

include "init.php";
if ($_POST["name"] !== '') {
  $sql = "UPDATE `reward_pool` SET `rp_name`='" . $_POST["name"] . "' WHERE `rp_id`='" . (int) $_POST["nameid"] . "'";
  $result = mysqli_query($db_conn, $sql);
  $row = mysqli_affected_rows($db_conn);
  if ((int) $row === 1) {
    echo '修改成功';
  } else {
    echo '修改失敗';
  }
} else {
  echo '獎品名稱不能為空';
}
mysqli_close($db_conn);

